const Controller = require('egg').Controller;
const utils = require('../utils/index');

class AppController extends Controller {
  /**
   * 获取列表
   */
  async list() {
    const { ctx } = this;
    const data = await ctx.service.book.list();
    const result = utils.result(data);
    ctx.body = result;
  }

  /**
   * 获取详情
   */
  async detail() {
    const { ctx } = this;
    const data = await ctx.service.book.detail();
    const result = utils.result(data);
    ctx.body = result;
  }

  /**
   * 更新
   */
  async update() {
    const { ctx } = this;
    const data = await ctx.service.book.update();
    const result = utils.result(data);
    ctx.body = result;
  }
  /**
   * 删除
   */
  async destroy() {
    const { ctx } = this;
    const data = await ctx.service.book.destroy();
    const result = utils.result(data);
    ctx.body = result;
  }
}

module.exports = AppController;
